<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <div>
        <label>姓名：</label>
        <input v-focus type="text"/>
    </div>
    <div>
        <label>年龄：</label>
        <input type="text"/>
    </div>
</div>
</body>
<script src="../../js/vue.js"></script>
<script type="text/javascript">
    var vm=new Vue({
        el:'#app',
        data(){
            return {}
        },
        directives:{
            focus:{
                inserted:function (el) {
                    el.focus()
                }
            }
        }
    })
</script>
</html>
